home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / ip / ka9q / aztecnos.arc / UDP.H < prev    next >
Encoding:
C/C++ Source or Header  |  1989-02-17  |  1.6 KB  |  58 lines

  1. #ifndef    NUDP
  2.  
  3. #include "global.h"
  4. #include "netuser.h"
  5.  
  6. /* User Datagram Protocol definitions */
  7.  
  8. #define    NUDP    20
  9.  
  10. /* Structure of a UDP protocol header */
  11. struct udp {
  12.     int16 source;    /* Source port */
  13.     int16 dest;    /* Destination port */
  14.     int16 length;    /* Length of header and data */
  15.     int16 checksum;    /* Checksum over pseudo-header, header and data */
  16. };
  17. #define    UDPHDR    8    /* Length of UDP header */
  18.  
  19. /* User Datagram Protocol control block
  20.  * Each entry on the receive queue consists of the
  21.  * remote socket structure, followed by any data
  22.  */
  23. struct udp_cb {
  24.     struct udp_cb *prev;    /* Linked list pointers */
  25.     struct udp_cb *next;
  26.     struct socket socket;    /* Local port accepting datagrams */
  27.     void (*r_upcall)();    /* Function to call when one arrives */
  28.     struct mbuf *rcvq;    /* Queue of pending datagrams */
  29.     int rcvcnt;        /* Count of pending datagrams */
  30. };
  31. extern struct udp_cb *Udps[];    /* Hash table for UDP structures */
  32. #define    NULLUDP    (struct udp_cb *)0
  33.  
  34. /* UDP statistics counters */
  35. struct udp_stat {
  36.     int16 rcvd;        /* Packets received */
  37.     int16 sent;        /* Packets sent */
  38.     int16 cksum;        /* Checksum errors */
  39.     int16 unknown;        /* Unknown socket */
  40.     int16 bdcsts;        /* Incoming broadcasts */
  41. };
  42.  
  43. /* UDP primitives */
  44. #if    defined(__STDC__) || defined(__TURBOC__)
  45. int recv_udp(struct udp_cb *up,struct socket *fsocket,struct mbuf **bp);
  46. int send_udp();
  47. int del_udp(struct udp_cb *up);
  48. void udp_dump(struct mbuf **bpp,int32 source,int32 dest,int check);
  49. struct udp_cb *open_udp();
  50. #else
  51. int recv_udp(),send_udp(),del_udp();
  52. void udp_dump();
  53. struct udp_cb *open_udp();
  54. #endif
  55.  
  56. #endif    /* NUDP */
  57.  
  58.